<!-----------充值记录页面------------->
<template>
  <div>
    <topheader :toptitle="toptitle"/>
    <div class="wrapper recharge-record">
      <div v-if="flag">
        <div class="table-header clearfix">
          <span>金额</span>
          <span>充值渠道</span>
          <span>充值时间</span>
        </div>
        <records :initial-records="recordlist"/>
      </div>
      <div v-else>
        <img class="norecord-img" src="static/img/norecord.png"/>
        <p class="bind-tip tc">还没有充值记录哦~</p>
      </div>
    </div>
  </div>
</template>


<script>
	import Vue from "vue"
  import topheader from '@/components/topheader'
  import records from '@/components/records'
  import apiConfig from '../config/api.js'
  

  export default {
    name: 'rechargerecords',
    components: {
      'topheader': topheader,
      'records': records
    },
    data() {
      return {
        toptitle: "充值记录",
        recordlist: [],
        flag: false
      }
    },
    created() {
			//请求参数
			let params = {
        appid: userInfoKit.appid,
        token: userInfoKit.getUserInfo().token
      }
      //请求充值记录接口
      this.$http(
        {
          method: "GET",
          url: apiConfig.app.user.payRecord,
          params: params,
          emulateJSON: true
        }).then(function (resp) {
        if (resp.body != null  && resp.body.length > 0) {        	
          this.flag = true
          this.recordlist = resp.body  
        } else {
        	this.flag = false                          
        }
      })
    }   
  }
</script>

